#include "thread.hpp"
#include "thread_pool.hpp"
#include <memory>
#include <cstdlib>
#include <time.h>
#include <cstring>


void test()
{
    int a = rand()%100;
    int b = rand()%100;
    
    cout<<a<<" + "<<b<<" = "<<a+b<<endl;
}
int main()
{
    srand(static_cast<size_t>(time(nullptr)));

    ThreadPool<void(*)(void)> threadPool(5);

    threadPool.init_thread();
    threadPool.start_all();
    // threadPool.addTask(test);
    for(int i = 0;i<20;++i)
    {
        threadPool.addTask(test);
        sleep(1);
    }
    threadPool.all_stop();
    threadPool.all_join();    
    return 0;
}